<?php $this->load->view('admin/ncategory/link_bar'); ?>
<form method="post" action="{$this->base_url}admin/ncategory/delete" class="form">
    <div class="box_function">
        <table width="747" border="0" cellpadding="0" cellspacing="0" class="listproduct" id="listproduct">
            <tbody>
                <tr>

                    <td class="tilte_list_pro">
                        <input name="checkme" class="noborder" onclick="checkDelBoxes(this.form, 'categoryBox[]', this.checked)" type="checkbox">
                    </td>
                    <td class="tilte_list_pro">
                        ID<br>
                        <a href=""><img src="{$this->base_url}images/admin/down.gif" border="0"></a>
                        <a href=""><img src="{$this->base_url}images/admin/up.gif" border="0"></a>
                    </td>
                    <td class="tilte_list_pro">
                        Name<br>

                        <a href=""><img src="{$this->base_url}images/admin/down.gif" border="0"></a>
                        <a href=""><img src="{$this->base_url}images/admin/up_d.gif" border="0"></a>
                    </td>
                    <td class="tilte_list_pro">
                        Description
                    </td>
                    <td class="tilte_list_pro">
                        Displayed
                    </td>
                    <td class="tilte_list_pro" style="width: 69px;">
                        Actions
                    </td>
                </tr>


                <?php
                for ($i = 0; $i < count($rows); $i++) {
                    $id = $rows[$i]->id_ncategory;
                    $name = $rows[$i]->vi_name;
                    $code = $rows[$i]->code;
                    $description = $rows[$i]->vi_description;
                    $parent = $rows[$i]->code;
                    if ($parent == '')
                        $parent = '_';
                    $active = $rows[$i]->active == 1 ? "checked.jpg" : "nocheck.jpg";
                    $id_next = $rows[$i]->id_next;
                    $id_preview = $rows[$i]->id_preview;
					$num_subcat = $rows[$i]->subcat;
                    if ($i % 2 == 0)
                        $css_class = 'row1';
                    else
                        $css_class = 'row2';
                    ?>
                    <tr onMouseOver="" class="<?php echo $css_class ?>">
                        <td class="product">
                            <input name="categoryBox[]" value="{$id}" class="noborder" type="checkbox"></td>
                        <td class="pointer center" onclick="document.location = '#'">
                            <?php echo $code ?>
                        </td>

                        <td class="product" onclick="document.location = '#'">
                            <?php 
                            if($num_subcat)
                            	echo "<a href='".site_url('admin/ncategory/view/' . $id)."'>$name</a>";
                            else 
                            	echo $name;
                            ?>
                        </td>
                        <td class="product" onclick="document.location = '#'">
                            <?php if ($id_next/* $order_view < $max_position AND isset($rows[$i+1]) */) { ?>
                                <a href="<?php echo site_url('admin/ncategory/change_order/'.$id . '/' . $id_next) ?>">
                                    <img src="<?php echo base_url() ?>images/admin/down.gif" alt="Up" title="Up" border="0">
                                </a>
                                <?php
                            }
                            if ($id_preview/* $order_view > $min_position AND isset($rows[$i-1]) */) {
                                ?>
                                <a href="<?php echo site_url() ?>/admin/ncategory/change_order/<?php echo $id . '/' . $id_preview; ?>">
                                    <img src="<?php echo base_url() ?>images/admin/up.gif" alt="Down" title="Down" border="0">
                                </a>
    <?php } ?>	
                        </td>
                        <td class="product center" onclick="document.location = '#'">
                            <a href="#"><img src="<?php echo base_url() . "images/admin/" . $active ?> " width="16" height="16" /></a>
                        </td>
                        <td class="product center">
                                <!--a href="<?php echo base_url() ?>admin/pcategory/view/<?php echo $parent ?>">
                                        <img src="<?php echo base_url() ?>images/admin/details.gif" alt="View" title="View" border="0">
                                </a-->
                            <a href="<?php echo site_url('admin/ncategory/edit/'.$id) ?>">
                                <img src="<?php echo base_url() ?>images/admin/edit.gif" alt="Edit" title="Edit" border="0">
                            </a>

                            <a href="<?php echo site_url('admin/ncategory/delete/'.$id) ?>" onclick="return confirm('Delete item #<?php echo $id ?>?');">
                                <img src="<?php echo base_url() ?>images/admin/delete.gif" alt="Delete" title="Delete" border="0">
                            </a>
                        </td>
                    </tr>
<?php } ?>

                <tr>
                    <td colspan="6">			
                        <p>
                            <input class="button" name="submitDelcategory" value="Delete selection" onclick="return confirm('Delete selected items?');" type="submit">
                        </p>
                    </td>
                </tr>

                <tr>
                    <td align="center">			
<?php echo $this->pagination->create_links(); ?>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</form>